package com.xzh.wms.controller;

import com.xzh.wms.entity.Permission;
import com.xzh.wms.entity.RolePermission;
import com.xzh.wms.service.RolePermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/permission")
@Slf4j
public class RolePermissionController {

    @Autowired
    private RolePermissionService rolePermissionService;


    @GetMapping
    public List<RolePermission> selectRole(RolePermission permission) {
        return rolePermissionService.select(permission);
    }

    @GetMapping("/permissionList")
    public List<Permission> insert(Permission permission) {
        return rolePermissionService.selectPermission(permission);
    }

    //    @PostMapping("/addRole")
//    public Integer insert(@RequestBody UserRole userRole){
//        return userRoleService.insert(userRole);
//    }
    @PostMapping()
    public Integer insert(@RequestBody RolePermission rolePermission) {
        return rolePermissionService.insert(rolePermission);
    }
}